<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <button>location</button>
    <button class="baidu">跳转</button>
    <div></div>
    <script>
        const btn = document.querySelector('button')
        const div = document.querySelector('div')
        const bd = document.querySelector('.baidu')
        btn.onclick = function() {
            let result = location + '<br/>'
            result += decodeURI(location)
            div.innerHTML = result
        }
        bd.onclick = function() {
            // location = 'https://www.baidu.com'
            // location = 'tab栏切换.html'
            location = '../pinyougou/index.html'
        }
    </script>
</body>

</html>